'\" t
.TH "UDEV_NEW" "3" "" "systemd 257" "udev_new"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
udev_new, udev_ref, udev_unref \- Create, acquire and release a udev context object
.SH "SYNOPSIS"
.sp
.ft B
.nf
#include <libudev\&.h>
.fi
.ft
.HP \w'struct\ udev\ *udev_new('u
.BI "struct udev *udev_new(" "void" ");"
.HP \w'struct\ udev\ *udev_ref('u
.BI "struct udev *udev_ref(struct\ udev\ *" "udev" ");"
.HP \w'struct\ udev\ *udev_unref('u
.BI "struct udev *udev_unref(struct\ udev\ *" "udev" ");"
.SH "DESCRIPTION"
.PP
\fBudev_new()\fR
allocates a new udev context object and returns a pointer to it\&. This object is opaque and must not be accessed by the caller via different means than functions provided by libudev\&. Initially, the reference count of the context is 1\&. You can acquire further references, and drop gained references via
\fBudev_ref()\fR
and
\fBudev_unref()\fR\&. Once the reference count hits 0, the context object is destroyed and freed\&.
.SH "RETURN VALUE"
.PP
On success,
\fBudev_new()\fR
returns a pointer to the allocated udev context\&. On failure,
\fBNULL\fR
is returned\&.
\fBudev_ref()\fR
returns the argument that it was passed, unmodified\&.
\fBudev_unref()\fR
always returns
\fBNULL\fR\&.
.SH "HISTORY"
.PP
\fBudev_new()\fR,
\fBudev_ref()\fR, and
\fBudev_unref()\fR
were added in version 221\&.
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1), \fBsystemd-udevd.service\fR(8)
